<?php
// +----------------------------------------------------------------------
// | 萤火商城系统 [ 致力于通过产品和服务，帮助商家高效化开拓市场 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2021 https://www.yiovo.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed 这不是一个自由软件，不允许对程序代码以任何形式任何目的的再发行
// +----------------------------------------------------------------------
// | Author: 萤火科技 <admin@yiovo.com>
// +----------------------------------------------------------------------
declare (strict_types = 1);

namespace app\api\controller;
use think\facade\Request;
/**
 * 商城设置控制器
 * Class Setting
 * @package app\store\controller
 */
class Store extends Controller
{
    public function apply(){
        $param = Request::param();
        if(empty($param['id_front'])){
            return $this->renderError('身份證正面必須傳');
        }
        if(empty($param['id_back'])){
            return $this->renderError('身份證背面必須傳');
        }
        if(empty($param['id_name'])){
            return $this->renderError('姓名必須傳');
        }
        if(empty($param['mobile'])){
            return $this->renderError('電話必須傳');
        }

        if(empty($param['store_name'])){
            return $this->renderError('店鋪名字必須傳');
        }
        $storeModel = new \app\common\model\Store();
        $storeModel->store_name = $param['store_name'];
        $storeModel->mobile = $param['mobile'];
        $storeModel->id_name = $param['id_name'];
        $storeModel->id_front = $param['id_front'];
        $storeModel->id_back = $param['id_back'];
        $storeModel->create_time = time();
        $storeModel->is_delete= 2;
        $storeModel->save();
        return $this->renderSuccess([], '店鋪申請成功，工作人員會在3個工作日類稽核完畢，請耐心等待');
    }


}
